image: Stop using gtk_widget_get_content_size
authorTimm Bäder <mail@baedert.org>
Mon, 4 Dec 2017 11:14:21 +0000 (12:14 +0100)
committerTimm Bäder <mail@baedert.org>
Mon, 4 Dec 2017 11:24:18 +0000 (12:24 +0100)
gtk/gtkimage.c

index 81710fa73b4efb8c7f508e5b0599c939d879c1b1..629319772b0a6c6697bc8abd39daf4aef25f517f 100644 (file)
@@ -1199,11 +1199,12 @@ gtk_image_snapshot (GtkWidget   *widget,
   int x, y, width, height;
   gint w, h, baseline;
 
-  gtk_widget_get_content_size (widget, &width, &height);
-  x = 0;
+  width = gtk_widget_get_width (widget);
+  height = gtk_widget_get_height (widget);
   y = 0;
 
   _gtk_icon_helper_get_size (&priv->icon_helper, &w, &h);
+  x = (width - w) / 2;
 
   baseline = gtk_widget_get_allocated_baseline (widget);
 
@@ -1212,8 +1213,6 @@ gtk_image_snapshot (GtkWidget   *widget,
   else
     y += CLAMP (baseline - h * gtk_image_get_baseline_align (image), 0, height - h);
 
-  x += (width - w) / 2;
-
   gtk_snapshot_offset (snapshot, x, y);
   gtk_icon_helper_snapshot (&priv->icon_helper, snapshot);
   gtk_snapshot_offset (snapshot, -x, -y);